package com.lz.controller.xjl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.lz.entity.CarParts;
import com.lz.service.xjl.CarPartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 徐建林
 * @date 2018/10/28 11:00
 */
@Controller
public class CarPartsController {
    @Autowired
    private CarPartsService carPartsService;

    @RequestMapping(value = "/getCarParts",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
    @ResponseBody
    public String getCarPartsList(){
        List<CarParts> carPartsList = carPartsService.getAllCarParts();
        System.out.println();

        return JSONArray.toJSONString(carPartsList);
    }


}
